package ;

/**
 * ...
 * @author michael
 */

class Server 
{

	static function main() 
	{
		var s = new neko.net.Socket();
		s.bind(new neko.net.Host("localhost"), 5000);
		s.listen(1);
		trace("Starting server...");
		while ( true )
		{
			var c : neko.net.Socket = s.accept();
			trace("Client connected..");
			c.write("hello\n");
			c.write("your IP is " + c.peer().host.toString() + "\n");
			var l = c.input.readLine();
			trace(l);
			c.write("exit");
			c.close();
		}
	}
	
}